home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
PROGRAMMING
/
DESKLIBC
/
SOURCES.ZIP
/
DeskLib
/
!DLSources
/
Libraries
/
Icon
/
c
/
FileIcon
< prev
next >
Wrap
Text File
|
1995-07-08
|
2KB
|
62 lines
/*
#### # # # #
# # # # # The FreeWare C library for
# # ## ### # # # # ### RISC OS machines
# # # # # # # # # # # ___________________________________
# # #### ### ## # # # #
# # # # # # # # # # Please refer to the accompanying
#### ### #### # # ##### # ### documentation for conditions of use
________________________________________________________________________
File: Icon.FileIcon.c
Author: Copyright © 1994 Tim Browse
Version: 1.01 (26 Jun 1994)
Purpose: Changes an icon in a window to display the correct filetype
sprite for the given filetype number.
*/
#include <stdio.h>
#include "DeskLib:Wimp.h"
#include "DeskLib:WimpSWIS.h"
#include "DeskLib:Icon.h"
void Icon_FileIcon(window_handle window, icon_handle icon, int filetype)
{
/* Icon should be an indirected text-only icon with enough room in text
buffer to hold the sprite name.
This converts to an indirected sprite-only icon, and fills in the sprite
name and area.
*/
icon_createblock iconcreate;
icon_handle handle;
/* Get the data for this icon */
Wimp_GetIconState(window, icon, &iconcreate.icondata);
/* Delete this icon - we have to change the data fields */
Wimp_DeleteIcon(window, icon);
/* Put sprite name in name field */
sprintf((char *) iconcreate.icondata.data.indirectsprite.name,
"file_%03x", filetype);
/* Fill in sprite area */
iconcreate.icondata.data.indirectsprite.spritearea = (unsigned int *) 1;
/* Fill in sprite name length */
iconcreate.icondata.data.indirectsprite.nameisname = 8; /* file_xxx */
/* Change to sprite-only */
iconcreate.icondata.flags.data.text = FALSE;
iconcreate.icondata.flags.data.sprite = TRUE;
/* Re-create the icon */
iconcreate.window = window;
Wimp_CreateIcon(&iconcreate, &handle);
/* Force the icon to be redrawn */
Wimp_SetIconState(window, handle, 0, 0);
}